module.exports = {
  mode: 'universal',
  /*
   ** Headers of the details
   */
  head: {
    title: process.env.npm_package_name || '',
    meta: [{
      charset: 'utf-8'
    },
      {
        name: 'viewport',
        content: 'width=device-width, initial-scale=1'
      },
      {
        hid: 'description',
        name: 'description',
        content: process.env.npm_package_description || ''
      }
    ],
    link: [{
      rel: 'icon',
      type: 'image/x-icon',
      href: '/favicon.ico'
    },
      {
        // bootstrap的css样式
        href: 'https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css',
        rel: 'stylesheet',
        integrity: 'sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u',
        crossorigin: 'anonymous'
      }
    ],
    script: [{
      // jquery
      src: 'https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js'
    }, {
      //bootstrap
      src: 'https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js',
      integrity: 'sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa',
      crossorigin: 'anonymous'
    }]
  },
  /*
   ** Customize the progress-bar color
   */
  loading: {
    color: '#fff'
  },
  /*
   ** Global CSS
   */
  css: [
    'element-ui/lib/theme-chalk/index.css',//　element-ui的css
    'assets/css/glb.css',//　自定义全局样式
    'assets/css/reset.css'//　重置基本样式
  ],
  /*
   ** Plugins to load before mounting the App
   */
  plugins: [
    { src: '@/plugins/vue-mavon-editor', ssr: false },
    {
      src: '@/plugins/element-ui'
    }, {
      //　v-charts图表
      src: '@/plugins/vcharts', ssr: false
    }, {
      //  ECharts图表
      src: '@/plugins/ECharts'
    },
    {
      src: '@/plugins/iview', ssr: true
    },
    {
      src: '@/plugins/axios'
    }
  ],
  /*
   ** Nuxt.js dev-modules
   */
  buildModules: [],
  /*
   ** Nuxt.js modules
   */
  modules: ['@nuxtjs/axios', '@nuxtjs/proxy'],
  //　axios请求
  axios: {
    proxy: true, // 表示开启代理
    // prefix: '/api/', // 表示给请求url加个前缀 /api
    // credentials: true, // 表示跨域请求时是否需要使用凭证
  },
  //　前端跨域
  proxy: {
  '/v1': {
    target: 'http://127.0.0.1:8080', // 目标接口域名
      changeOrigin: true, // 表示是否跨域
      pathRewrite: {
      '^/v1': '/v1', // 把 /api 替换成 /
    }
  }
},
  /*
   ** Build configuration
   */
  build: {
    transpile: [/^element-ui/],
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {
    },
    vendor:['axios'] // 防止重复打包
  }
}

// 网页打包的时候　注释掉

// {
//   // mock数据
//   let mock2easy = require('mock2easy');
//   let defaultConfig = {
//     port: 8020,//端口
//     lazyLoadTime: 3001,
//     database: 'mock2easy',
//     doc: 'doc',
//     ignoreField: [],
//     interfaceSuffix: '.json',
//     preferredLanguage: 'cn',
//   };
//   //
//   mock2easy(defaultConfig, function (app) {
//     app.listen(defaultConfig.port, function () {
//       console.log(
//         ('mock2easy数据　地址 : http://127.0.0.1:' + defaultConfig.port).bold.cyan
//       );
//     });
//   });
// }
